﻿Public Class ServerManagerForm 

    Private Sub ServerManagerForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        InitData()
    End Sub

    Private Sub InitData()

        Dim atableList As DataTable = CommonExt.Utils.SMOExt.GetNetworkServerTable()
        Dim dtlSQLServers As ArrayList
        dtlSQLServers = CommonExt.Utils.SMOExt.GetNetworkServerList("S-CORP-SQL\SQLCORP2005")

        If dtlSQLServers.Count > 0 Then
            For Each serverName As String In dtlSQLServers
                listNetworkServer.Items.Add(serverName)
            Next
        End If



        Dim dtlLocalSQLServers As ArrayList
        dtlLocalSQLServers = CommonExt.Utils.SMOExt.GetLocalServerList()

        If dtlLocalSQLServers.Count > 0 Then
            For Each serverName As String In dtlLocalSQLServers
                listLocalServer.Items.Add(serverName)
            Next
        End If

        GridControl1.DataSource = atableList




    End Sub

    Private Sub listLocalServer_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles listLocalServer.SelectedIndexChanged

    End Sub

    Private Sub listNetworkServer_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles listNetworkServer.SelectedIndexChanged

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim dtlLocalSQLServers As ArrayList
        dtlLocalSQLServers = CommonExt.Utils.SMOExt.GetNetworkServerList()

        If dtlLocalSQLServers.Count > 0 Then
            For Each serverName As String In dtlLocalSQLServers
                listLocalServer.Items.Add(serverName)

            Next
        End If



        dtlLocalSQLServers = CommonExt.Utils.SMOExt.GetNetworkServerVersion()

        If dtlLocalSQLServers.Count > 0 Then
            For Each serverName As String In dtlLocalSQLServers
                listLocalServer.Items.Add(serverName)
            Next
        End If

    End Sub
End Class